@echo off
for /f "usebackq delims=" %%i in (`chcp`) do set oldcharmap=%%i
for /f "usebackq delims=" %%i in (`chdir`) do set currentdir=%%i

set PHPDIR=%currentdir%\php5
set OLDPATH=%PATH%

FOR %%a IN (%oldcharmap%) DO (
      FOR /F "tokens=1 delims=," %%b IN ("%%a") DO (
      set oldpage=%%b))

chcp 932 > nul
SET PATH=%PATH%;%PHPDIR%\ext\
%PHPDIR%\php.exe main.php
chcp %oldpage% > nul
PATH=%OLDPATH%